In computer networking a routing table, or Routing Information Base (RIB), is a data table stored in a router or a networked computer that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes. The routing table contains information about the topology of the network immediately around it. The construction of routing tables is the primary goal of routing protocols. Static routes are entries made in a routing table by non-automatic means and which are fixed rather than being the result of some network topology 'discovery' procedure.
Contents |
A routing table utilizes the same idea that one does when using a map in package delivery. Whenever a node needs to send data to another node on a network, it must know where to send it, first. If the node cannot directly connect to the destination node, it has to send it via other nodes along a proper route to the destination node. Most nodes do not try to figure out which route(s) might work; instead, a node will send an IP packet to a gateway in the LAN, which then decides how to route the "package" of data to the correct destination. Each gateway will need to keep track of which way to deliver various packages of data, and for this it uses a Routing Table. A routing table is a database which keeps track of paths, like a map, and allows the gateway to provide this information to the node requesting the information.
With hop-by-hop routing, each routing table lists, for all reachable destinations, the address of the next device along the path to that destination: the next hop. Assuming that the routing tables are consistent, the simple algorithm of relaying packets to their destination's next hop thus suffices to deliver data anywhere in a network. Hop-by-hop is the fundamental characteristic of the IP Internetwork Layer [1] and the OSI Network Layer.
The need to record routes to large numbers of devices using limited storage space represents a major challenge in routing table construction. In the Internet, the currently dominant address aggregation technology is a bitwise prefix matching scheme called Classless Inter-Domain Routing (CIDR).
Since in a network each node presumably possesses a valid routing table, routing tables must be consistent among the various nodes or routing loops can develop. This is particularly problematic in the hop-by-hop routing model in which the net effect of inconsistent tables in several different routers could be to forward packets in an endless loop. Routing loops have historically plagued routing, and their avoidance is a major design goal of routing protocols.
The routing table consists of at least three information fields:
Depending on the application and implementation, it can also contain additional values that refine path selection:
Routing tables are also a key aspect of certain security operations, such as unicast reverse path forwarding (uRPF).[2] In this technique, which has several variants, the router also looks up, in the routing table, the source address of the packet. If there exists no route back to the source address, the packet is assumed to be malformed or involved in a network attack, and is dropped.
Network id | Cost | Next hop |
---|---|---|
........ | ........ | ........ |
........ | ........ | ........ |
Shown below is an example of what the table above could look like on an average computer connected to the internet via a home router:
Network Destination | Netmask | Gateway | Interface | Metric |
---|---|---|---|---|
0.0.0.0 | 0.0.0.0 | 192.168.0.1 | 192.168.0.100 | 10 |
127.0.0.0 | 255.0.0.0 | 127.0.0.1 | 127.0.0.1 | 1 |
192.168.0.0 | 255.255.255.0 | 192.168.0.100 | 192.168.0.100 | 10 |
192.168.0.100 | 255.255.255.255 | 127.0.0.1 | 127.0.0.1 | 10 |
192.168.0.255 | 255.255.255.255 | 192.168.0.100 | 192.168.0.100 | 10 |
Routing tables are generally not used directly for packet forwarding in modern router architectures; instead, they are used to generate the information for a smaller forwarding table. A forwarding table contains only the routes which are chosen by the routing algorithm as preferred routes for packet forwarding. It is often in a compressed or pre-compiled format that is optimized for hardware storage and lookup.
This router architecture separates the Control Plane function of the routing table from the Forwarding Plane function of the forwarding table. [3] This separation of control and forwarding provides uninterrupted forwarding in production environments, along with enhanced performance.